package com.grass.p019lv.adapter;

import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.androidsa.bttsddka.R;
import com.androidx.p013lv.base.APPLink;
import com.androidx.p013lv.base.Constance;
import com.androidx.p013lv.base.bean.VideoBean;
import com.androidx.p013lv.base.glide.GlideUtils;
import com.androidx.p013lv.base.interfaces.Key;
import com.androidx.p013lv.base.recycler.BaseRecyclerAdapter;
import com.androidx.p013lv.base.recycler.BaseRecyclerHolder;
import com.androidx.p013lv.base.service.AdClickService;
import com.androidx.p013lv.base.utils.TimeUtils;
import com.androidx.p013lv.base.utils.UiUtils;
import com.bumptech.glide.Glide;

/* renamed from: com.grass.lv.adapter.AvAreaStationAdapter */
public class AvAreaStationAdapter extends BaseRecyclerAdapter<VideoBean, Holder> {
    private boolean clickLimit = true;
    String domain;
    private long lastClickTime;
    int stationId;

    public void setDomain(String str) {
        this.domain = str;
    }

    public void setStationId(int i) {
        this.stationId = i;
    }

    public void MyHolder(Holder holder, int i) {
        holder.setData((VideoBean) this.list.get(i), i);
    }

    public void onViewRecycled(Holder holder) {
        super.onViewRecycled((RecyclerView.ViewHolder) holder);
        ImageView imageView = holder.iv_cover;
        if (imageView != null) {
            Glide.with(imageView.getContext()).clear(imageView);
        }
    }

    @Override // androidx.recyclerview.widget.RecyclerView.Adapter
    public Holder onCreateViewHolder(ViewGroup viewGroup, int i) {
        return new Holder(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_av_area_station, viewGroup, false));
    }

    /* access modifiers changed from: package-private */
    /* renamed from: com.grass.lv.adapter.AvAreaStationAdapter$Holder */
    public class Holder extends BaseRecyclerHolder {
        private APPLink appLink;
        public ImageView iv_cover;
        public ImageView iv_hd;
        public ImageView iv_original;
        public ImageView iv_pay;
        public ImageView iv_vip;
        public ImageView iv_xm;
        public LinearLayout ll_pay_gold_bg;
        public RelativeLayout rl_ad;
        public RelativeLayout root_view;
        public TextView tv_download;
        public TextView tv_gold_originalPrice;
        public TextView tv_pay;
        public TextView tv_pay_normal;
        public TextView tv_play_times;
        public TextView tv_time;
        public TextView tv_title;

        public Holder(View view) {
            super(view);
            this.iv_cover = (ImageView) view.findViewById(R.id.iv_cover);
            this.iv_original = (ImageView) view.findViewById(R.id.iv_original);
            this.iv_vip = (ImageView) view.findViewById(R.id.iv_vip);
            this.iv_xm = (ImageView) view.findViewById(R.id.iv_xm);
            this.iv_hd = (ImageView) view.findViewById(R.id.iv_hd);
            this.ll_pay_gold_bg = (LinearLayout) view.findViewById(R.id.ll_pay_gold_bg);
            this.tv_gold_originalPrice = (TextView) view.findViewById(R.id.tv_gold_originalPrice);
            this.tv_pay = (TextView) view.findViewById(R.id.tv_pay);
            this.tv_pay_normal = (TextView) view.findViewById(R.id.tv_pay_normal);
            this.tv_play_times = (TextView) view.findViewById(R.id.tv_play_times);
            this.tv_time = (TextView) view.findViewById(R.id.tv_time);
            this.tv_title = (TextView) view.findViewById(R.id.tv_title);
            this.iv_pay = (ImageView) view.findViewById(R.id.iv_pay);
            this.rl_ad = (RelativeLayout) view.findViewById(R.id.rl_ad);
            this.tv_download = (TextView) view.findViewById(R.id.tv_download);
        }

        public void setData(final VideoBean videoBean, int i) {
            ViewGroup.LayoutParams layoutParams = this.iv_cover.getLayoutParams();
            layoutParams.height = (int) ((double) (((UiUtils.getWindowWidth() - UiUtils.dp2px(24)) * 9) / 16));
            this.iv_cover.setLayoutParams(layoutParams);
            if (videoBean.getCoverImg() == null || videoBean.getCoverImg().size() <= 0 || TextUtils.isEmpty(videoBean.getCoverImg().get(0))) {
                GlideUtils.loadCropRadiusDefault(10, this.iv_cover);
            } else {
                GlideUtils.loadCropRadiusWh2(AvAreaStationAdapter.this.domain + videoBean.getCoverImg().get(0), 10, this.iv_cover, Constance.BIG_PIC);
            }
            this.iv_cover.setOnClickListener(null);
            if (videoBean.isAd()) {
                this.rl_ad.setVisibility(0);
                this.iv_xm.setVisibility(8);
                this.tv_title.setVisibility(8);
                this.tv_play_times.setVisibility(8);
                this.tv_time.setVisibility(8);
                this.iv_xm.setVisibility(8);
                this.iv_vip.setVisibility(8);
                this.ll_pay_gold_bg.setVisibility(8);
                this.tv_pay_normal.setVisibility(8);
                this.iv_pay.setVisibility(8);
                this.iv_cover.setOnClickListener(new View.OnClickListener() {
                    /* class com.grass.p019lv.adapter.AvAreaStationAdapter.Holder.View$OnClickListenerC29661 */

                    public void onClick(View view) {
                        if (videoBean.getAdInfoBean().getJumpType() == 2) {
                            try {
                                Intent intent = new Intent();
                                intent.setAction("android.intent.action.VIEW");
                                intent.setData(Uri.parse(videoBean.getAdInfoBean().getAdJump()));
                                view.getContext().startActivity(intent);
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                        } else {
                            if (Holder.this.appLink == null) {
                                Holder.this.appLink = new APPLink(view.getContext());
                            }
                            Holder.this.appLink.urlLink(videoBean.getAdInfoBean().getAdJump());
                        }
                        Intent intent2 = new Intent(view.getContext(), AdClickService.class);
                        intent2.putExtra("adId", videoBean.getAdInfoBean().getAdId());
                        view.getContext().startService(intent2);
                    }
                });
                this.tv_download.setOnClickListener(new View.OnClickListener() {
                    /* class com.grass.p019lv.adapter.AvAreaStationAdapter.Holder.View$OnClickListenerC29672 */

                    public void onClick(View view) {
                        if (videoBean.getAdInfoBean().getJumpType() == 2) {
                            try {
                                Intent intent = new Intent();
                                intent.setAction("android.intent.action.VIEW");
                                intent.setData(Uri.parse(videoBean.getAdInfoBean().getAdJump()));
                                view.getContext().startActivity(intent);
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                        } else {
                            if (Holder.this.appLink == null) {
                                Holder.this.appLink = new APPLink(view.getContext());
                            }
                            Holder.this.appLink.urlLink(videoBean.getAdInfoBean().getAdJump());
                        }
                        Intent intent2 = new Intent(view.getContext(), AdClickService.class);
                        intent2.putExtra("adId", videoBean.getAdInfoBean().getAdId());
                        view.getContext().startService(intent2);
                    }
                });
                return;
            }
            this.iv_cover.setOnClickListener(new View.OnClickListener() {
                /* class com.grass.p019lv.adapter.AvAreaStationAdapter.Holder.View$OnClickListenerC29683 */

                public void onClick(View view) {
                    if (!AvAreaStationAdapter.this.isOnClick()) {
                        ARouter.getInstance().build(Constance.VIDEO_PLAY_ACTIVITY).withSerializable(Key.VIDEO_ID, Integer.valueOf(videoBean.getVideoId())).navigation();
                    }
                }
            });
            this.rl_ad.setVisibility(8);
            this.tv_title.setVisibility(0);
            this.tv_play_times.setVisibility(0);
            this.tv_time.setVisibility(0);
            this.tv_title.setText(videoBean.getTitle());
            this.tv_play_times.setText(UiUtils.num2str(videoBean.getFakeWatchNum()));
            this.tv_time.setText(TimeUtils.stringForTime(videoBean.getPlayTime() * 1000));
            this.iv_original.setVisibility(8);
            if (videoBean.isSelfMade()) {
                this.iv_original.setVisibility(0);
            } else {
                this.iv_original.setVisibility(8);
            }
            this.iv_xm.setVisibility(8);
            this.iv_vip.setVisibility(8);
            this.ll_pay_gold_bg.setVisibility(8);
            this.tv_pay_normal.setVisibility(8);
            this.iv_pay.setVisibility(8);
            if (videoBean.getVideoType() == 1) {
                this.iv_vip.setVisibility(0);
            } else if (videoBean.getVideoType() == 2) {
                this.iv_pay.setVisibility(0);
            } else if (videoBean.getVideoType() == 0) {
                this.iv_xm.setVisibility(0);
            }
            if (videoBean.isSelfMade()) {
                this.iv_original.setVisibility(0);
            } else {
                this.iv_original.setVisibility(8);
            }
        }
    }

    public boolean isOnClick() {
        long currentTimeMillis = System.currentTimeMillis();
        long j = currentTimeMillis - this.lastClickTime;
        if (j > 1000) {
            this.lastClickTime = currentTimeMillis;
        }
        return !this.clickLimit ? j < 0 : j <= 1000;
    }
}
